//package com.budgetme.widgets;
//
//import java.text.SimpleDateFormat;
//import java.util.Calendar;
//import java.util.Locale;
//
//import com.budgetme.R;
//import com.budgetme.database.Database;
//import com.budgetme.database.Database.tbl_expenses;
//
//import android.app.Activity;
//import android.appwidget.AppWidgetManager;
//import android.content.ContentValues;
//import android.content.Context;
//import android.content.Intent;
//import android.net.Uri;
//import android.os.Bundle;
//import android.util.Log;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.view.WindowManager.LayoutParams;
//import android.view.inputmethod.InputMethodManager;
//import android.widget.Button;
//import android.widget.EditText;
//import android.widget.TextView;
//
//
//public class AddExpenseSimple extends Activity implements OnClickListener {
//	private static final String TAG = AddExpenseSimple.class.getName();
//	
//	private int mBucketId;
//	private String mBucketName;
//	private int mAppWidgetId;
//		
//	//private EditText mExpenseNameInput;
//	private EditText mExpenseAmountInput;
//	private TextView mBucketTitle;
//	
//	// TODO: Increase the size of the edittext fields
//	
//	// TODO: Need to look at a listview for listing expenses or something.  Maybe have a tab that displays expenses
//	
//	@Override
//	public void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        Log.d(TAG, "onCreate");
//        
//        setContentView(R.layout.add_expense);
//        
//        Intent starter = getIntent();
//        
//        mBucketId = starter.getIntExtra("bucket_id", 0);
//        mBucketName = starter.getStringExtra("bucket_name");
//        mAppWidgetId = starter.getIntExtra("widget_id", 0);
//        
//        // TODO: Could put some of these in the onclick to speed up loading of the activity
//        //mExpenseNameInput = (EditText) findViewById(R.id.expense_name_input);
//        mExpenseAmountInput = (EditText) findViewById(R.id.expense_amount_input);
//        mBucketTitle = (TextView) findViewById(R.id.bucket_title);
//        
//        mBucketTitle.setText(mBucketName);
//        
//        findViewById(R.id.expense_submit).setOnClickListener(this);
//        
//        getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
//		
//	}
//	
//	@Override
//	public void onClick(View view) {
//		
//		String date = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US).format(Calendar.getInstance().getTime());
//		Log.w(TAG, "Date: " + date);
//		Uri uri = Database.tbl_expenses.CONTENT_URI;
//		
//		ContentValues values = new ContentValues();
//		//values.put(Database.tbl_expenses.e_name, mExpenseNameInput.getText().toString());
//		values.put(Database.tbl_expenses.e_amount, mExpenseAmountInput.getText().toString());
//		values.put(Database.tbl_expenses.b_id, mBucketId);
//		values.put(Database.tbl_expenses.e_date, date);
//		
//		Uri result = getContentResolver().insert(uri, values);
//		Log.d(TAG, result.toString());
//		
//		// Update the widget associated with this bucket
//		AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this);
//		BudgetWidget.updateBucketWidget(this, appWidgetManager, mAppWidgetId);
//		
//		finish();
//		
//	}
//	
//	@Override
//	public void onBackPressed() {
//		Log.d(TAG, "onBackPressed");
//		Intent intent = new Intent(Intent.ACTION_MAIN);
//	    intent.addCategory(Intent.CATEGORY_HOME);
//	    startActivity(intent);
//	}
//	
//	@Override
//	public void onDestroy() {
//		super.onDestroy();
//		Log.d(TAG, "onDestroy");
//	}
//	
//	@Override
//	public void onPause() {
//		super.onPause();
//		Log.d(TAG, "onPause");
//		finish();
//	}
//	
//	@Override
//	public void onResume() {
//		super.onResume();
//		Log.d(TAG, "onResume");
//	}
//
//}
